//
// Created by martin on 8/6/21.
//

#ifndef FTPSERVER2_0_TASK_H
#define FTPSERVER2_0_TASK_H

#include <event2/bufferevent.h>
#include "session.h"

/**
 * 用户任务
 */
typedef struct task{
    int connfd;               /* socket连接fd */
    struct event_base *base;  /* libevent上下文 */
    struct bufferevent *bev;  /* 绑定到控制连接的bufferevent缓冲区 */
    Session *sess;            /* 会话对象 */
}Task;

Task* task_new();
void task_free(Task *task);
int  task_init(Task *task, struct event_base *base);
void task_setConnfd(Task *task, int connfd);

#endif //FTPSERVER2_0_TASK_H
